package com.itpengwei.simplefactory;

/**
 * @author: pengwei
 * @date: 2019/11/28 7:34 下午
 * 画图工厂类
 */
public class ShapeFactory {
    /**
     * @param shapeType 图形名称
     * @return 根据名称获取对应类型bean
     */
    public Shape getShape(String shapeType) {
        Shape shape = null;
        switch (shapeType) {
            case "circle":
                shape = new Circle();
                break;
            case "rectangle":
                shape = new Rectangle();
                break;
            case "square":
                shape = new Square();
                break;

        }
        return shape;
    }
}
